package com.jacobson.huobi.mvp.model

import com.alibaba.fastjson.JSONObject
import com.jacobson.core.di.annotation.ActivityScope
import com.jacobson.core.framework.repository.IRepositoryManager
import com.jacobson.core.mvp.BaseModel
import com.jacobson.huobi.api.KycAuthApi
import com.jacobson.huobi.entities.response.CommonResponse
import com.jacobson.huobi.entities.vo.KycAuthResVo
import com.jacobson.huobi.mvp.contract.KycAuthContract
import io.reactivex.Observable
import okhttp3.MultipartBody
import javax.inject.Inject

@ActivityScope
class KycAuthModel @Inject constructor(
    repositoryManager: IRepositoryManager
) : BaseModel(repositoryManager), KycAuthContract.Model {

    private val kycAuthApi =
        repositoryManager.obtainRetrofitService(KycAuthApi::class.java)

    override fun submitKycAuth(kycAuthResVo: KycAuthResVo): Observable<CommonResponse<JSONObject>> {
        return kycAuthApi.submitKycAuth(kycAuthResVo)
    }

    override fun loadKycDetail(width: Int): Observable<CommonResponse<JSONObject>> {
        return kycAuthApi.loadKycDetail(width)
    }

    override fun kycUpload(
        file: MultipartBody.Part,
        side: String,
        width: Int
    ): Observable<CommonResponse<String>> {
        return kycAuthApi.kycUpload(file, side, width)
    }
}